<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>j1008_4</title>
<style>
.r {
	background: black;
	color: white;
}
</style>
<script src="js/jquery-2.1.1.js"></script>

<script src="js/jquery-2.1.1.min.js"></script>
<script>
	$(document).ready(function() {
		$("form#frm1").submit(function(event) {
			//이름 필수입력
			var name = $("#uName").val();
			if (name == "") {
				alert("이름 필수입력");
				$('#uName').focus();
				event.prreventDefault();//이벤트기본속성 제거
			}

			//비번과 비번확인 일치여부체크
			var pwd1 = $("#uPwd1").val();
			var pwd2 = $("#uPwd2").val();
			if (pwd1 != pwd2) {
				alert("비번과 비번확인 일치해야해요");
				$("#uPwd1").val("");
				$("#uPwd2").val("");//초기화
				$("#uPwd1").focus();

				event.preveatDefault();//이벤트기본속성 제거
			}

		});

	}); // end of $(document).ready()
</script>
</head>

<body>
	<h1>입력양식 관련이벤트</h1>

	<form id="frm1" name="frm1" action="ok.html" method="get">
		<label for="uName">이름</label> <input type="text" id="uName"
			name="uName" /><br /> <label for="uPwd1">비밀번호</label> <input
			type="password" id="uPwd1" name="uPwd1" /><br /> <label for="uPwd2">비밀번호확인</label>
		<input type="password" id="uPwd2" name="uPwd2" /><br /> <input
			type="submit" value="확인">
	</form>
</body>
</html>
